package caip2022p.rcv7;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

public class Main {
    public static void main(String[] args) throws NumberFormatException, IOException {
    	//优化输入
    	BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
    	//优化输出
        StringBuilder sb = new StringBuilder();
        //Scanner scanner = new Scanner(System.in);
        
        // 获取飞走的
        int N = Integer.parseInt(br.readLine());
        Map<String, Integer> dict1 = new HashMap<>();
        for (int i = 0; i < N; i++) {
            dict1.put(br.readLine(), 0);
        }
        
        // 获取返回的
        int M = Integer.parseInt(br.readLine());
        for (int i = 0; i < M; i++) {
            String data = br.readLine();
            dict1.put(data, dict1.getOrDefault(data, -2) + 1);
        }
        
        // 没飞回的列表
        List<String> mis = new ArrayList<>();
        // 新来的列表
        List<String> newItems = new ArrayList<>();
        
        for (Map.Entry<String, Integer> entry : dict1.entrySet()) {
            if (entry.getValue() == -1) {
                newItems.add(entry.getKey());
            }
            if (entry.getValue() == 0) {
                mis.add(entry.getKey());
            }
        }
        
        // 输出结果，用StringBuilder优化
        if (mis.isEmpty()) {
            //System.out.println("All Back");
        	sb.append("All Back\n");
        } else {
            //System.out.println("Missing: " + mis.size());
        	sb.append("Missing: ");
        	sb.append(mis.size());
        	sb.append("\n");
        	//排序
            Collections.sort(mis);
            for (String item : mis) {
                //System.out.println(item);
            	sb.append(item);
            	sb.append("\n");
            }
        }
        
        if (newItems.isEmpty()) {
            //System.out.println("All Known");
        	sb.append("All Known\n");
        } else {
            //System.out.println("New: " + newItems.size());
        	sb.append("New: ");
        	sb.append(newItems.size());
        	sb.append("\n");
        	//排序
            Collections.sort(newItems);
            for (String item : newItems) {
                //System.out.println(item);
            	sb.append(item);
            	sb.append("\n");
            }
        }
        
        System.out.print(sb.toString());
    }
}
